package pokerLogic2;

import neuroPoker.poker.Karte;

public class PLKarte extends Karte implements Comparable<PLKarte> {
	public int wertInt;

	public PLKarte(char w, char f) {
		super(w, f);
		setInt();
	}

	public PLKarte(Karte k) {
		super(k.w, k.f);
		setInt();
	}

	public boolean gleicherWert(PLKarte k) {
		if (k.w == w)
			return true;
		else
			return false;
	}

	public boolean gleicheFarbe(PLKarte k) {
		if (k.f == f)
			return true;
		else
			return false;
	}

	public boolean gleicheKarte(PLKarte k) {
		if (k.f == f && k.w == w)
			return true;
		else
			return false;
	}

	public String toString() {
		return "" + w + f;
	}

	public void setInt() {
		String wStr = "" + w;
		int wI = 0;
		try {
			wI = Integer.parseInt(wStr);
		} catch (Exception e) {
			if (w == 'T')
				wertInt = 10;
			if (w == 'J')
				wertInt = 11;
			if (w == 'Q')
				wertInt = 12;
			if (w == 'K')
				wertInt = 13;
			if (w == 'A')
				wertInt = 14;
			return;
		}
		wertInt = wI;
	}

	public boolean hoeher(PLKarte k) {
		if (this.wertInt > k.wertInt)
			return true;
		return false;
	}

	public int compareTo(PLKarte k) {
		return ((PLKarte) k).wertInt - wertInt;
	}

}
